/*
 * Copyright (c) 2013-2015 Charkey. All rights reserved.
 *
 * This software is the confidential and proprietary information of Charkey.
 * You shall not disclose such Confidential Information and shall use it only
 * in accordance with the terms of the agreements you entered into with Charkey.
 *
 * Charkey MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
 *
 * Charkey SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
 * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
 */

package cn.simastudio.talos.common.constants;

/**
 * Usage: 定义项目常量（如果是数据库字段的枚举值，需要定义为枚举值Enum）
 *
 * @author Charkey
 * @date 2015/5/11 9:59
 */
public class SimaConstants {

    /**
     * ERROR：API 失败
     */
    public static final String OPERATION_FAILED = "OperationFailed";

    /**
     * ERROR：API 异常
     */
    public static final String OPERATION_ERROR = "OperationError";

    /**
     * 用户名最短长度
     */
    public static final int USERNAME_MIN_LENGTH = 2;

    /**
     * 用户名最长长度
     */
    public static final int USERNAME_MAX_LENGTH = 20;

    /**
     * 密码最短长度
     */
    public static final int PASSWORD_MIN_LENGTH = 5;

    /**
     * 密码最长长度
     */
    public static final int PASSWORD_MAX_LENGTH = 50;

    /**
     * 二维码尺寸（中）320px,11.289cm
     */
    public static final int QRCODE_SIZE_MEDIUM = 320;

    /**
     * 二维码尺寸（小）240px,8.466cm
     */
    public static final int QRCODE_SIZE_SMALL = 240;

    public static final int IMAGE_MAX_SIZE = 2097152;

    /**
     * 全局默认分页查询页码
     */
    public static final int DEFAULT_PAGE = 1;

    /**
     * 全局默认分页查询分页大小
     */
    public static final int DEFAULT_ROWS = 10;

    /**
     * 短信验证码有效时间，十分钟。缓存中
     */
    public static final int CAPTCHA_VALID_MINUTES = 10;

    public static final int DEFAULT_UPDATE_COUNT = 1;

    public static final int DEFAULT_DELETE_COUNT = 1;

    public static final class Auth {

        /**
         * OAuth2.0授权登录返回类型-参数
         */
        public static final String REQUEST_FOR = "request_for";

        /**
         * OAuth2.0授权登录返回类型-值1
         */
        public static final String REQUEST_FOR_PAGE = "page";

        /**
         * OAuth2.0授权登录返回类型-值2
         */
        public static final String REQUEST_FOR_JSON = "json";

        public static final String AUTH_ID = "id";

        public static final String AUTH_NONCE = "nonce";

        public static final String AUTH_MAC = "mac";
    }

    public static final class System {

        /**
         * 当前登录的用户
         */
        public static final String CURRENT_USER = "current_user";

        /**
         * 当前登录的用户名
         */
        public static final String CURRENT_USERNAME = "current_username";

        /**
         * 当前请求API的用户的tel
         */
        public static final String API_CONSUMER = "api_consumer";

        /**
         * 当前请求API的用户的id
         */
        public static final String API_CONSUMER_ID = "api_consumer_id";
    }

    public static final class Response {

        /**
         * 所属模块
         */
        public static final String MODULE = "module";

        /**
         * 错误编码
         */
        public static final String CODE = "code";

        /**
         * 错误信息: model.addAttribute(SimaConstants.Response.MESSAGE, getMessage());
         */
        public static final String MESSAGE = "message";

        /**
         * 响应信息For开发者
         */
        public static final String DEVELOP_MESSAGE = "develop_message";
    }

    public static final class Cache {

        public static final String telCaptchaCache = "telCaptchaCache";

        public static final String passwordRetryCache = "passwordRetryCache";

        public static final String configurationCache = "configurationCache";
    }

    public static final class CacheService {

        public static final String EHCACHE = "ehCacheServiceImpl";
    }
}
